package  mvc.action;


  import mvc.service.IDemoService;
  import mvcframework.annotation.MYAutowired;
  import mvcframework.annotation.MYController;
  import mvcframework.annotation.MYRequestMapping;
  import mvcframework.annotation.MYRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ClassName DemoAction
 * @Description TODO
 * @Author liang
 * @Date 2018/8/27 9:24
 * @Version 1.0
 **/

@MYController()
@MYRequestMapping("/demo")
public class DemoAction {

    @MYAutowired
    private IDemoService service;


    @MYRequestMapping("/query")
    public void query(HttpServletRequest req, HttpServletResponse resp,@MYRequestParam("name") String name) throws IOException {
        String result = service.get(name);
        resp.getWriter().write(result);
    }

    @MYRequestMapping("/")
    public void query2(HttpServletRequest req, HttpServletResponse resp,@MYRequestParam("name") String name) throws IOException {
        String result = service.get(name);
        resp.getWriter().write(result);
    }
}
